package com.xbongbong.paas.domain.dao;

import com.xbongbong.paas.domain.entity.PaasProcessRelatedDataEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author: lee
 * @date: 2020/07/13 14:04
 * @desrcption: 流程中间数据
 */
@Repository
@Mapper
public interface PaasProcessRelatedDataDao {


    /**
     * 插入
     * @param entity
     * @return
     */
    Integer insert(PaasProcessRelatedDataEntity entity);

    /**
     * 更新
     * @param paasApp
     * @return
     */
    Integer update(PaasProcessRelatedDataEntity paasApp);

    /**
     * 批量插入
     * @param entityList
     */
    void insertBatch(@Param("list") List<PaasProcessRelatedDataEntity> entityList);

    /**
     * 删除
     * @param key
     * @param corpid
     * @return
     */
    Integer deleteByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    /**
     * 获取一条数据
     * @param key
     * @param corpid
     * @return
     */
    PaasProcessRelatedDataEntity getByKey(@Param("key") Integer key, @Param("corpid") String corpid);

    /**
     * 查询数据
     * @param param
     * @return
     */
    List<PaasProcessRelatedDataEntity>  findEntitys(@Param("param") Map<String, Object> param);

    /**
     * 获取数据总计
     * @param param
     * @return
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 查询单个实体
     * @param key
     * @param corpid
     * @return
     */
    List<PaasProcessRelatedDataEntity> getByTaskId(@Param("taskId") Long key, @Param("corpid") String corpid);

    void deleteByTaskId(@Param("taskId") Long taskId, @Param("corpid") String corpid);

    /**
     * 批量插入
     * @param entityList
     */
    void updateBatch(@Param("list") List<PaasProcessRelatedDataEntity> entityList, @Param("corpid") String corpid);

    void updateFlowStatusByTaskId(@Param("taskId") Long taskId, @Param("corpid") String corpid, @Param("flowStatus") Integer flowStatus);

    List<PaasProcessRelatedDataEntity> getByRefIdAndBusinessType(@Param("refId") Long refId, @Param("businessType") Integer businessType, @Param("corpid")String corpid);
}
